package com.itheima.web;

import com.itheima.polo.brand;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/ELservlet")
public class ELservlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            //1.准备数据
        List<brand> list = new ArrayList<>();
        list.add(new brand("张三","20"));
        list.add(new brand("李四","30"));
        //2.存储到request域中
        request.setAttribute("list",list);
        //3.转发到EL页面
        request.getRequestDispatcher("/el.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
